﻿using System.Collections.Generic;

namespace ThresholdAssistant.Http
{
    /// <summary>
    /// Policy重试配置选项
    /// </summary>
    public class PolicyOptions
    {
        /// <summary>
        /// 固定的时间范围内（单位：秒）
        /// </summary>
        public int SamplingDuration { get; set; } = 10;

        /// <summary>
        /// 最少共有多少次调用
        /// </summary>
        public int MinimumThroughput { get; set; } = 100;

        /// <summary>
        /// 熔断高级配置
        /// 至少50%有异常则熔断
        /// </summary>
        public double FailureThreshold { get; set; } = 0.8;

        /// <summary>
        /// 断开时间（单位：秒）
        /// </summary>
        public int DurationOfBreakSeconds { get; set; } = 10;

        /// <summary>
        /// 重试等待间隔间隔
        /// 默认：1秒，5秒，15秒
        /// </summary>
        public IEnumerable<int> SleepDurationList { get; set; } = new int[] { 1, 5, 15 };
    }
}